export const menuTypeEnum = [
  {
    value: 1,
    text: '目录'
  },
  {
    value: 2,
    text: '菜单'
  },
  {
    value: 3,
    text: '系统'
  },

  {
    value: 4,
    text: '按钮'
  },
  {
    value: 5,
    text: '外链'
  }
]

export const getDirectionary = async (req, res) => {
  let type = req.body.type

  if (type === undefined) {
    res.json({
      code: -1,
      data: null,
      message: '请传入需要查询的枚举类型 [type]'
    })
    return
  }

  let key = type + 'enum'

  if (key === undefined) {
    res.json({
      code: -1,
      data: null,
      message: `枚举值不存在 ${type}`
    })

    return
  }

  res.json({
    code: 1000,
    data: key,
    message: '操作成功'
  })
}
